Personal tools

Lua/Client/ClientParticleSystem/Static Functions/Create

From JC2-MP Documentation

Jump to: navigation, search

Returns    ClientParticleSystem
Prototype    ClientParticleSystem.Create(AssetLocation, table arguments)
Description    No description


Argument table

Required values

Type Name Notes
Vector3 position
Angle angle
string path See here for the complete list of paths

Examples

Create an explosion where you click

  1. particleSystems = {}
  2.  
  3. Events:Subscribe("MouseDown", function(args)
  4. 	if args.button ~= 1 then
  5. 		return
  6. 	end
  7.  
  8. 	local result = Physics:Raycast(
  9. 		Camera:GetPosition(),
  10. 		Camera:GetAngle() * Vector3.Forward,
  11. 		0,
  12. 		100
  13. 	)
  14.  
  15. 	local spawnArgs = {
  16. 		position = result.position + result.normal * 0.25,
  17. 		angle = Angle(),
  18. 		path = "fx_exp_grenade_01.psm",
  19. 	}
  20. 	local particleSystem = ClientParticleSystem.Create(AssetLocation.Game, spawnArgs)
  21.  
  22. 	table.insert(particleSystems, particleSystem)
  23. end)
  24.  
  25. -- Make sure to clean up everything on ModuleUnload.
  26. Events:Subscribe("ModuleUnload", function()
  27. 	for index, particleSystem in ipairs(particleSystems) do
  28. 		particleSystem:Remove()
  29. 	end
  30. end)